<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <img class="img" src="" alt="">
    <script>
        // 获取图片元素
        var img = document.querySelector('.img');
        var index = 0; // 当前显示第几张图片
        setInterval(function() {
            if(index<6) {
                index ++ // 显示后一张图
                img.src = './imgs/'+index+'.png'
            }else {
                // 循环结束后重新开始
                index = 0;
            }
        }, 1000);
    </script>
</body>
</html>